﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <!-- Documenting T:NAnt.NUnit2.Tasks.NUnit2Task-->
  <head>
    <meta http-equiv="Content-Language" content="en-ca" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="../style.css" />
    <title>&lt;nunit2&gt; Task</title>
  </head>
  <body>
    <table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
      <tr>
        <td class="NavBar-Cell">
          <a href="http://nant.sourceforge.net">
            <b>NAnt</b>
          </a>
          <img alt="-&gt;" src="../images/arrow.gif" />
          <a href="../index.html">Help</a>
          <img alt="-&gt;" src="../images/arrow.gif" />
          <a href="../tasks/index.html">Task Reference</a>
          <img alt="-&gt;" src="../images/arrow.gif" /> &lt;nunit2&gt;</td>
        <td class="NavBar-Cell" align="right">
                        v0.91-alpha2</td>
      </tr>
    </table>
    <h1>&lt;nunit2&gt;</h1>
    <p class="topicstatus">[This is preliminary documentation and subject to change.]</p>
    <p> Runs tests using the NUnit V2.2 framework. </p>
    <p> The <code>haltonfailure</code> attribute is only useful when more than one test suite is used, and you want to continue running other test suites although a test failed. </p>
    <p> Set <code>failonerror</code> to <b>false</b> to ignore any errors and continue the build. </p>
    <p> In order to run a test assembly built with NUnit 2.0 or 2.1 using <a href="../tasks/nunit2.html">&lt;nunit2&gt;</a> task, you must add the following node to your test config file : </p>
    <pre class="code">
&lt;configuration&gt;
    ...
    &lt;runtime&gt;
        &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
            &lt;dependentAssembly&gt;
                &lt;assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /&gt; 
                &lt;bindingRedirect oldVersion="2.0.6.0" newVersion="2.2.8.0" /&gt; 
                &lt;bindingRedirect oldVersion="2.1.4.0" newVersion="2.2.8.0" /&gt; 
            &lt;/dependentAssembly&gt;
        &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
    ...
&lt;/configuration&gt;
    </pre>
    <p> See the <a href="http://nunit.sf.net">NUnit home page</a> for more information. </p>
    <h3>Parameters</h3>
    <div class="table">
      <table>
        <tr>
          <th>Attribute</th>
          <th style="text-align: center;">Type</th>
          <th>Description</th>
          <th style="text-align: center;">Required</th>
        </tr>
        <tr>
          <td valign="top">haltonfailure</td>
          <td style="text-align: center;">bool</td>
          <td> Stop the test run if a test fails. The default is <b>false</b>. </td>
          <td style="text-align: center;">False</td>
        </tr>
        <tr>
          <td valign="top">failonerror</td>
          <td style="text-align: center;">bool</td>
          <td> Determines if task failure stops the build, or is just reported. The default is <b>true</b>. </td>
          <td style="text-align: center;">False</td>
        </tr>
        <tr>
          <td valign="top">if</td>
          <td style="text-align: center;">bool</td>
          <td> If <b>true</b> then the task will be executed; otherwise, skipped. The default is <b>true</b>. </td>
          <td style="text-align: center;">False</td>
        </tr>
        <tr>
          <td valign="top">unless</td>
          <td style="text-align: center;">bool</td>
          <td> Opposite of <code>if</code>. If <b>false</b> then the task will be executed; otherwise, skipped. The default is <b>false</b>. </td>
          <td style="text-align: center;">False</td>
        </tr>
        <tr>
          <td valign="top">verbose</td>
          <td style="text-align: center;">bool</td>
          <td> Determines whether the task should report detailed build log messages. The default is <b>false</b>. </td>
          <td style="text-align: center;">False</td>
        </tr>
      </table>
    </div>
    <h3>Nested Elements:</h3>
    <!--Array-->
    <!--NestedElementArray=T:NAnt.NUnit2.Types.NUnit2Test-->
    <h4>
      <a id="test">
      </a>
                    &lt;test&gt;
                </h4>
    <div class="nested-element"> Tests to run. <p> Represents a <code>test</code> element of an <a href="../tasks/nunit2.html">&lt;nunit2&gt;</a> task. </p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top">appconfig</td><td style="text-align: center;">file</td><td> The application configuration file to use for the NUnit test domain. If not specified, NAnt will try to use a configuration name matching the file name of the assembly with extension ".config". </td><td style="text-align: center;">False</td></tr><tr><td valign="top">assemblyname</td><td style="text-align: center;">file</td><td> Name of the assembly to search for tests. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">haltonfailure</td><td style="text-align: center;">bool</td><td> Build fails on failure. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">testname</td><td style="text-align: center;">string</td><td> Name of a specific testfixture to run. If not specified then all testfixtures are run. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">transformfile</td><td style="text-align: center;">file</td><td> XSLT transform file to use when using the <code>Plain</code> formatter. </td><td style="text-align: center;">False</td></tr></table></div><h3>Nested Elements:</h3><!--Element--><h4><a id="assemblies"></a>
                    &lt;<a href="../types/assemblyfileset.html">assemblies</a>&gt;
                </h4><div class="nested-element"> Assemblies to include in test. <p /></div><h4><a id="assemblies"></a>
                    &lt;/<a href="../types/assemblyfileset.html">assemblies</a>&gt;
                </h4><!--Element--><h4><a id="references"></a>
                    &lt;<a href="../types/assemblyfileset.html">references</a>&gt;
                </h4><div class="nested-element"> Assemblies to scan for missing assembly references. <p /></div><h4><a id="references"></a>
                    &lt;/<a href="../types/assemblyfileset.html">references</a>&gt;
                </h4><!--Element--><h4><a id="categories"></a>
                    &lt;<a href="../types/categories.html">categories</a>&gt;
                </h4><div class="nested-element"> Categories of test cases to include or exclude. <p /></div><h4><a id="categories"></a>
                    &lt;/<a href="../types/categories.html">categories</a>&gt;
                </h4></div>
    <h4>
      <a id="test">
      </a>
                    &lt;/test&gt;
                </h4>
    <!--Array-->
    <!--NestedElementArray=T:NAnt.NUnit.Types.FormatterElement-->
    <h4>
      <a id="formatter">
      </a>
                    &lt;formatter&gt;
                </h4>
    <div class="nested-element"> Formatters to output results of unit tests. <p> Represents the FormatterElement of the NUnit task. </p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">type</td><td style="text-align: center;"><a href="../enums/NAnt.NUnit.Types.FormatterType.html">FormatterType</a></td><td> Type of formatter. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">extension</td><td style="text-align: center;">string</td><td> Extension to append to the output filename. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">outputdir</td><td style="text-align: center;">directory</td><td> Specifies the directory where the output file should be written to, if <code>usefile</code> is <b>true</b>. If not specified, the output file will be written to the directory where the test module is located. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">usefile</td><td style="text-align: center;">bool</td><td> Determines whether output should be persisted to a file. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div>
    <h4>
      <a id="formatter">
      </a>
                    &lt;/formatter&gt;
                </h4>
    <h3>Examples</h3>
    <ul class="examples">
      <li>
        <p> Run tests in the <code>MyProject.Tests.dll</code> assembly. </p>
        <pre class="code">
&lt;nunit2&gt;
    &lt;formatter type="Plain" /&gt;
    &lt;test assemblyname="MyProject.Tests.dll" appconfig="MyProject.Tests.dll.config" /&gt;
&lt;/nunit2&gt;
    </pre>
      </li>
      <li>
        <p> Only run tests that are not known to fail in files listed in the <code>tests.txt</code> file. </p>
        <pre class="code">
&lt;nunit2&gt;
    &lt;formatter type="Xml" usefile="true" extension=".xml" outputdir="${build.dir}/results" /&gt;
    &lt;test&gt;
        &lt;assemblies&gt;
            &lt;includesfile name="tests.txt" /&gt;
        &lt;/assemblies&gt;
        &lt;categories&gt;
            &lt;exclude name="NotWorking" /&gt;
        &lt;/categories&gt;
        &lt;references basedir="build"&gt;
            &lt;include name="Cegeka.Income.Services.dll" /&gt;
            &lt;include name="Cegeka.Util.dll" /&gt;
        &lt;/references&gt;
    &lt;/test&gt;
&lt;/nunit2&gt;
    </pre>
      </li>
    </ul>
    <h3>Requirements</h3>
    <div style="margin-left: 20px;">
      <b>Assembly:</b> NAnt.NUnit2Tasks (0.91.3881.0)
            </div>
  </body>
</html>